package com.m4f.city.business.oauth2.ifc;

import java.util.Collection;
import java.util.List;

import com.m4f.city.business.domain.oauth2.OAuth2AccessTokenDS;
import com.m4f.city.business.domain.oauth2.OAuth2RefreshTokenDS;

public interface OAuth2TokensService {
	
	OAuth2AccessTokenDS createAccessToken();
	OAuth2RefreshTokenDS createRefreshToken();
	
	void save(OAuth2AccessTokenDS accessToken) throws Exception;
	void save(OAuth2RefreshTokenDS refreshToken) throws Exception;
	
	List<OAuth2AccessTokenDS> getAllAccessToken() throws Exception;
	List<OAuth2RefreshTokenDS> getAllRefreshToken() throws Exception;
	
	OAuth2AccessTokenDS getAccessToken(String tokenValue) throws Exception;
	OAuth2RefreshTokenDS getRefreshToken(String tokenValue) throws Exception;
	
	void removeAccessToken(OAuth2AccessTokenDS token) throws Exception;
	void removeAccessToken(String tokenValue) throws Exception;
	void removeAccessTokenByRefresToken(String tokenValue) throws Exception;
	void removeAccessToken(Long userId, String clientId) throws Exception;
	
	void removeRefreshToken(OAuth2RefreshTokenDS token) throws Exception;
	void removeRefreshToken(String tokenValue) throws Exception;
	void removeRefreshToken(Long userId, String clientId) throws Exception;
	
	Collection<OAuth2AccessTokenDS> getAllAccessToken(Long userId, String clientId) throws Exception;
	Collection<OAuth2RefreshTokenDS> getAllRefreshToken(Long userId, String clientId) throws Exception;
	
	OAuth2AccessTokenDS getAccessToken(Long userId, String clientId) throws Exception;
	OAuth2RefreshTokenDS getRefreshToken(Long userId, String clientId) throws Exception;
}